package service;

import dao.SubCategoryDao;
import entity.SubCategory;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * Created by jifeng on 2016/12/12 0012.
 */
public class SubCategoryService {
    @Autowired
    private SubCategoryDao subCategoryDao;

    public SubCategoryDao getSubCategoryDao() {
        return subCategoryDao;
    }

    public void setSubCategoryDao(SubCategoryDao subCategoryDao) {
        this.subCategoryDao = subCategoryDao;
    }

    public SubCategory addSubCategory(SubCategory subCategory,int id){
        subCategoryDao.addSubCategory(subCategory,id);
        return subCategory;
    }
    public List findSubCategoryList(){
        return subCategoryDao.findSubCategoryList();
    }

    public List findSubCategoryListById(int id){
        return  subCategoryDao.findSubCategoryListById(id);
    }

    public SubCategory findSubCategoryById(int id){
        return subCategoryDao.findSubCategoryById(id);
    }

    public void deleteSubCategory(int id){
        subCategoryDao.deleteSubCategory(id);
    }

    public void updateSub(int id,String name){
        subCategoryDao.updateSub(id,name);
    }
}
